<?php

namespace app\api\controller\User;

use app\services\UserTeamService;
use support\Request;

class TeamController
{
    public function list(Request $request)
    {
        try {
            $page = $request->post('page', 1);
            $length = $request->post('length', 10);
            $isRecommend = $request->post('is_recommend', 0);
            $level = $request->post('level', 0);

            $data = UserTeamService::children($page, $length, $isRecommend, $level);
            return ok_rsp('成功', $data);
        } catch (\Exception $e) {
            return e_rsp($e);
        }
    }

    public function info(Request $request)
    {
        try {
            $data = UserTeamService::teamInfo();
            return ok_rsp('成功', $data);
        } catch (\Exception $e) {
            return e_rsp($e);
        }
    }
}